<template>
  <div class="preview-container">
  
    <div class="start-btn">
      <!-- <el-button  @click="startExam">开始考试</el-button> -->
        <el-button  @click="showRole">开始考试</el-button>
    </div>
    <div class="role-exam">
       <div class="btn">
        <!-- <el-button  @click="()=>this.$router.push({name:'QuickScene'})" style="float: right;" icon="el-icon-arrow-right">
        </el-button> -->
        <el-button  @click="()=>this.$router.push({name:'ShowImg'})" style="float: right;" icon="el-icon-arrow-right">
        </el-button>
       </div>
    </div>

    <!-- <div class="role-exam" v-if="roleExam">
      <img src="/images/bg/5.png" alt="">
      
      <div class="btn">
        <el-button  @click="backExam" icon="el-icon-arrow-left">
        </el-button>
        <el-button @click="startExam" icon="el-icon-arrow-right" style="float: right;">
        </el-button>
      </div>
    </div> -->

  </div>
</template>

<script>
import { getToken } from '@/utils/auth';
export default {
  name: "PreviewRequired",

  created(){
    // if(!getToken)
      this.adminLogin()
  },

  data(){
    return{
      roleExam:false,
      loginForm:{
        username:'',
        password:''
      }
    }
  },
  methods: {
    adminLogin() {
      this.loginForm.username = "admin";
      this.loginForm.password = "lxl123456";
      this.handleLogin();
    },
    handleLogin() {
      this.$store
            .dispatch("user/login", this.loginForm)
            .then(() => {
              this.$router.push({
                path: '/final',
                query: this.otherQuery,
              });
              this.loading = false;
            })
            .catch(() => {
              this.loading = false;
            });
    },
    
    showRole(){
      this.roleExam = true
    },
    startExam() {
      this.$router.push({name:"QuickScene"})
    },
    backExam(){
      if(!this.roleExam){
        this.$router.go(-1)
        return
      }
      this.roleExam = false
    }
  }
}
</script>

<style scoped>
.preview-container {
  min-height: 100vh;
  /* background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ed 100%); */
  background-image: url("/images/bg/1.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* padding: 20px; */
}

.start-btn{
  position: relative;
}

.start-btn .el-button{
  width: 480px;
  height: 180px;
  position: absolute;
  bottom: -255px;
  left: -240px;
  /* border-radius: 10%; */
  opacity: 0;
}

.role-exam {
  width: 100%;
  height: 100%;
  display: flex;
}

.role-exam img{
  width: 100%;
  height: 100%;
}

.btn{
  width: 99%;
  bottom: 20px;
  position: fixed;
  opacity: 0.3;
}


</style>